package cn.set;

/**
 * Set集合不能存放重复元素
 * @author Mxb
 * @version 1.0
 * @date 2020/4/9 14:49
 */
public interface Set<E> {
    int size();
    boolean isEmpty();
    void clear();
    boolean contains(E element);
    void add(E element);
    void remove(E element);

    /**
     * 遍历集合
     * @param visitor
     */
    void traversal(Visitor<E> visitor);

    public static abstract class Visitor<E>{
        boolean stop;
        abstract boolean visit(E element);
    }
}
